package top.xiaoshuaila.moments.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.xiaoshuaila.moments.mapper.VisitorMapper;
import top.xiaoshuaila.moments.pojo.RespBean;
import top.xiaoshuaila.moments.pojo.Visitor;
import top.xiaoshuaila.moments.utils.Usersutils;

import javax.servlet.http.HttpServletRequest;

@Service
public class VisitorServiceImpl implements VisitorService {
    @Autowired
    private VisitorMapper visitorMapper;
    @Override
    public RespBean visitorInfo(long vid, long id) {
        return RespBean.success("success", visitorMapper.getVisitById(vid,id));
    }

    @Override
    public RespBean getdynamic(long vid,int page) {
        return RespBean.success("success",visitorMapper.getdynamic(Usersutils.getuser().getId(),vid,page*5,5)) ;
    }

    @Override
    public RespBean gettotal(long vid) {
        return RespBean.success("success",visitorMapper.gettotal(vid)) ;
    }
}
